#ifndef CSERVERNETENGINE_H
#define CSERVERNETENGINE_H

#include <QThread>
#include <QDir>

class CConnectMsg;
class CSourceMsg;

class QTcpSocket;

/**
  * This is the server-side network engine. It's derived from QRunnable since we want each one of these to run in it's own
  * separate thread. It expects a connected socket - this is the communication platform with the client end - the socket
  * will be closed by the FSM before it completes.
  */
class CServerNetEngine : public QThread
{
	Q_OBJECT
public:
	CServerNetEngine(int nSocketDescriptor);
	void run();
private:
	int m_nSocketDescriptor;
};


class CThreadContainer: public QObject
{
	Q_OBJECT
	public:
		CThreadContainer(int nSocket);
		~CThreadContainer();

	protected slots:
		void onData();
		void projectProgress(int nCurrent, int nTotal, const QString &strHint);
		void projectFinished();
	protected:
		void onClientConnect(CConnectMsg *pMsg);
		void onClientSource(CSourceMsg* pMsg);
		QDir getNewTempPath() const;
	private:
		QTcpSocket *m_pSocket;
};

#endif // CSERVERNETENGINE_H
